package com.study.d3_annotation;

import java.lang.reflect.Method;

/**
 * 目标：模拟Junit框架的设计
 */
public class AnnoTest4 {
    //    @MyTest5
    public void test1() {
        System.out.println("test1");
    }

    @MyTest5
    public void test2() {
        System.out.println("test2");
    }

    //    @MyTest5
    public void test3() {
        System.out.println("test3");
    }

    @MyTest5
    public void test4() {
        System.out.println("test4");
    }

    @MyTest5
    public void test5() {
        System.out.println("test5");
    }

    public static void main(String[] args) throws Exception{
        Class<AnnoTest4> c = AnnoTest4.class;
        Method[] methods = c.getDeclaredMethods();
        for (Method method : methods) {
            if(method.isAnnotationPresent(MyTest5.class)){
                method.invoke(new AnnoTest4());
            }
            
        }
    }
}
